"Javascript is used to communicate
with HTML elements"

Two ways to include JS on php/html page :-

1- On page
<script type="text/javascript">
  // UR JS CODE GOES HERE
</script>
2- Add external JS
<script src="PATH_OF_JS_FILE" type="text/javascript"></script>
--------------------------------
for(), if(), switch(), while(),
do while(), continue, break,
if-else , try-catch are all same as
PHP
--------------------------------
Q.  How to take varibale in JS ?
Ans :

use "var" keyword before varibale name.

"No need to define datatypes of varibales as PHP"

Ex:

var num = 123;
var str = "Hello World";
-------------------------------
Semi Colon is optional at the end of statement.
:) But for better programming practice we have to use semicolon
at the end of statement.
-------------------------------

-------------------------------
Q. How to detect DataTypes of variables ?
A. alert(typeof 123);
--------------------------------
